<template>
  <a-select
    v-bind="$attrs"
    v-on="$listeners"
    label-in-value
    :show-search="showSearch"
    :filter-option="filterOption"
    :allowClear="allowClear"
    :value="value"
  >
    <a-select-option
      :value="item[replaceFields.key]"
      :label="item[replaceFields.label]"
      v-for="item in dataResource"
      :key="item[replaceFields.key]"
    >
      {{ item[replaceFields.label] }}
    </a-select-option>
  </a-select>
</template>

<script>
import props from "./props";
export default {
  name: "bj-select",
  mixins: [props],
  data() {
    return {
      val: undefined,
    };
  },
  methods: {
    //select 搜索过滤
    filterOption(input, option) {
      return (
        option.componentOptions.children[0].text
          .toLowerCase()
          .indexOf(input.toLowerCase()) >= 0
      );
    },
  },
};
</script>

<style></style>
